#ifndef LOOP_BUF_H_
#define LOOP_BUF_H_ 

#ifdef __cplusplus
extern "C"{
#endif

#define MAX(a,b)        ((a) > (b) ? (a) : (b))
#define MIN(a,b)        ((a) < (b) ? (a) : (b))

#define LOOP_BUF_SIZE    (2560*1024 + 1)

typedef struct
{	 
	volatile signed long in;
	volatile signed long out;
	signed long size;
	char* buffer;
}loop_buf;


signed long InitLoopBuf(loop_buf *buf, signed long size);

void ReleaseLoopBuf(loop_buf *buf);

signed long PutLoopBuf(loop_buf *buf, char *buffer, signed long len);

signed long GetLoopBuf(loop_buf *buf, char *buffer, signed long len);

signed long LoopBufSize(loop_buf *buf);
 
void LoopBufReset(loop_buf *buf);

signed long LoopBufLen(loop_buf *buf);

#ifdef __cplusplus
}
#endif

#endif //LOOPBUF_H_
